﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ToRTalent {
    public partial class ProgressBar : UserControl {
        public ProgressBar() {
            InitializeComponent();
        }

        private bool _isRepublic;

        /// <summary>
        /// Gets or sets a value indicating if the selected class is republic or not. 
        /// Also sets the talent panel border using the given value.
        /// </summary>
        public bool IsRepublic {
            get { return _isRepublic; }
            set {
                _isRepublic = value;

                LinearGradientBrush borderBrush = new LinearGradientBrush();
                GradientStop leftGradStop = new GradientStop();
                GradientStop rightGradStop = new GradientStop();
                GradientStop midOneGradStop = new GradientStop();
                GradientStop midTwoGradStop = new GradientStop();

                borderBrush.StartPoint = new Point( 0, 0.5 );
                borderBrush.EndPoint = new Point( 1, 0.5 );
                leftGradStop.Offset = 0;
                midOneGradStop.Offset = 0.087;
                midTwoGradStop.Offset = 0.89;
                rightGradStop.Offset = 1;

                leftGradStop.Color = _isRepublic ? Color.FromArgb( 0x00, 0x0E, 0x8B, 0xC8 ) :
                                                   Color.FromArgb( 0x00, 0xA7, 0x0D, 0x0D );

                midOneGradStop.Color = _isRepublic ? Color.FromArgb( 0xFF, 0x0E, 0x8B, 0xC8 ) :
                                                     Color.FromArgb( 0xFF, 0xA7, 0x0D, 0x0D );

                midTwoGradStop.Color = _isRepublic ? Color.FromArgb( 0xFF, 0x0E, 0x8B, 0xC8 ) :
                                                     Color.FromArgb( 0xFF, 0xA7, 0x0D, 0x0D );

                rightGradStop.Color = _isRepublic ? Color.FromArgb( 0x00, 0x0E, 0x8B, 0xC8 ) :
                                                    Color.FromArgb( 0x00, 0xA7, 0x0D, 0x0D );

                borderBrush.GradientStops.Add( leftGradStop );
                borderBrush.GradientStops.Add( midOneGradStop );
                borderBrush.GradientStops.Add( midTwoGradStop );
                borderBrush.GradientStops.Add( rightGradStop );
                ProgressBorder.Fill = borderBrush;
            }
        }
    }
}
/*
Middle = _isRepublic ? Color.FromArgb( 0xFF, 0x0E, 0x8B, 0xC8 ) :
                                                   Color.FromArgb( 0xFF, 0xA7, 0x0D, 0x0D );
Left and Right = _isRepublic ? Color.FromArgb( 0x00, 0x0E, 0x8B, 0xC8 ) :
                                                      Color.FromArgb( 0x00, 0xA7, 0x0D, 0x0D );
*/